Component({
  properties: {
    // money:Number
    money: {
      type: Number,
      value: 0
    }
  },
  data: {
    num: 1,
    count: 999,
    total: 1000,
    userInfo: {
      name: '张三',
      age: 18
    }
  },
  observers: {
    // num(newVal) {
    //   console.log('num改变成:', newVal);
    // }
    "num,count"(newVal1, newVal2) {
      console.log('num改变成:', newVal1);
      console.log('count改变成:', newVal2);
      this.setData({
        total: newVal1 + newVal2
      })
    }
    // "**"(newVal) {
    //   console.log('有值改变了');
    // },
    // "userInfo.**"(newVal) {
    //   console.log('userInfo修改了', newVal);
    // }
  },
  methods: {
    addNum() {
      this.setData({
        num: this.data.num + 1
      })
    },
    addCount() {
      this.setData({
        count: this.data.count + 1
      })
    },
    addAge() {
      this.setData({
        "userInfo.age": this.data.userInfo.age + 1
      })
    },
    setmoney() {
      console.log(this.data.money, this.properties.money);
      console.log(this.data === this.properties);
      this.setData({
        money: this.data.money + 1
      })
    }
  }



})